package com.haoran.dwz.config;

import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.google.code.kaptcha.servlet.KaptchaServlet;

/**
 * 生成验证码配置
 */
@Configuration
public class KaptchaConfig {

	/**
	 * 这个方法名称如果采用 servletRegistrationBean就不会注册Servlet上去???
	 * @return
	 */
	@Bean
	public ServletRegistrationBean kaptchaServletRegistrationBean() {
		ServletRegistrationBean srb = new ServletRegistrationBean(new KaptchaServlet(), "/except/kaptcha");
		srb.setName("KaptchaServlet");
		return srb;
	}
	
}
